home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™94 / Miscellaneous / Randy Thelen / ThreadedSort / Misc Stuff / TextView.h < prev   
Encoding:
C/C++ Source or Header  |  1994-06-26  |  2.3 KB  |  82 lines  |  [TEXT/MPS ]

  1. #ifndef        _TEXTVIEW_
  2. #define        _TEXTVIEW_
  3.  
  4. #ifndef        __TYPES__
  5. #include    <Types.h>
  6. #endif
  7.  
  8. #ifndef        __CONTROLS__
  9. #include    <Controls.h>
  10. #endif
  11.  
  12. #ifndef        __WINDOWS__
  13. #include    <Windows.h>
  14. #endif
  15.  
  16. #ifndef        __PRINTING__
  17. #include    <Printing.h>
  18. #endif
  19.  
  20. #define        kTextViewMargin            4
  21. #define        kScrollBarThickness        15
  22. #define        kHScrollAmount            20
  23.  
  24. #define        kPrintHeaderStyle        (bold+italic)
  25.  
  26.  
  27. typedef struct TTextLineInfo TTextLineInfo,*TTextLineInfoPtr,**TTextLineInfoHandle;
  28. struct    TTextLineInfo
  29.     {
  30.     unsigned long    fOffsetFromTextStart;
  31.     short            fLineLength;
  32.     Style            fTextStyle;
  33.     unsigned long    fRefCon;
  34.     };
  35.  
  36. typedef    struct    TTextView    TTextView,*TTextViewPtr,**TTextViewHandle;
  37. struct    TTextView
  38.     {
  39.     WindowPtr                fWindow;
  40.     Boolean                    fActive;
  41.     Rect                    fViewRect;
  42.     Rect                    fTextSizeRect;
  43.  
  44.     unsigned long            fSelectionStart;
  45.     unsigned long            fSelectionEnd;
  46.     
  47.     unsigned long            fTopLine;
  48.     unsigned long            fLineCount;
  49.     TTextLineInfoHandle        fTextLineInfoArrayHandle;
  50.     Handle                    fTextHandle;
  51.     
  52.     ControlHandle            fVerticalScroll,fHorizontalScroll;
  53.     };
  54.  
  55.  
  56. TTextViewHandle    NewTextView(WindowPtr theWindow,Rect *viewRect);
  57. void            DisposeTextView(TTextViewHandle theTextView);
  58.  
  59. void            UpdateTextView(TTextViewHandle theTextView,RgnHandle updateRgn);
  60.  
  61. void            PrintHeader(Rect *pageRectangle,StringPtr documentName,short pageNum,short baseLine);
  62. void            PrintPages(short fontNum,short fontSize,TPPrPort thePrPort,Rect *pageRectangle,StringPtr documentName,TTextViewHandle theTextView);
  63. void            PrintTextView(THPrint printRecord,StringPtr documentName,TTextViewHandle theTextView);
  64.  
  65. void            ActivateTextView(TTextViewHandle theTextView,Boolean activating);
  66. void            ResizeTextView(TTextViewHandle theTextView,Rect *newSize);
  67.  
  68. Boolean            ClickTextView(TTextViewHandle theTextView,Point where,long *lineHit,Boolean isDoubleClick);
  69. unsigned long    GetTextLineRefCon(TTextViewHandle theTextView,long theLine);
  70. void            SelectLine(TTextViewHandle theTextView,long lineHit);
  71.  
  72. void            SetTextViewSelection(TTextViewHandle theTextView,unsigned long selStart,unsigned long selEnd);
  73. void            GetTextViewSelection(TTextViewHandle theTextView,unsigned long *selStart,unsigned long *selEnd);
  74. void            CopyTextViewSelectionToScrap(TTextViewHandle theTextView);
  75.  
  76. void            AddStringToTextView(TTextViewHandle theTextView,Str255 theTextToAdd,Style theTextStyle,long refCon);
  77.  
  78. void            ScrollTextView(TTextViewHandle theTextView,unsigned long newTopLine);
  79.  
  80.     
  81. #endif
  82.